import React from 'react';
import './App.css';
import { connect } from 'react-redux'
import Cmp1 from './component/cmp'

class App extends React.Component {
  modName () {
    this.props.setName('2222')
  }
  render () {
    return (
        <div className="App">
          <header className="App-header">
            <p onClick={() => {this.modName()}}>
              Edit <code>src/App.js</code> and save to reload.
            </p>
            {this.props.name}
          </header>
          <Cmp1 />
        </div>
      );
  }
  
}

export default connect((state, props) => {
  return state.user
}, {
  setName (name) {
    return {
      type: 'newName',
      name
    }
  }
})(App);
